package com.oliver.proxy.midjourney.infrastructure.mapper;

import com.oliver.proxy.midjourney.domain.entity.TaskList;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;

@Mapper
public interface TaskListMapper {
    Long insert(TaskList taskList);
    void update(TaskList taskList);
    void deleteById(@Param("taskId") Long taskId);
    TaskList selectById(@Param("taskId") Long taskId);
    List<TaskList> selectAll();
    List<TaskList> selectByCategory(@Param("category") String category);
    List<TaskList> selectByStatus(@Param("status") Integer status);

    @Select("SELECT t.task_id, t.task_category, t.task_switch_num, p.data_id, t.task_prompt, t.img_size " +
            "FROM task_list t " +
            "INNER JOIN prod p ON t.task_id = p.task_id " +
            "WHERE t.task_type = 1 AND p.prompt IS NULL " +
            "ORDER BY t.task_id, p.data_id")
    List<Map<String, Object>> selectTasksWithEmptyPrompts();
} 